package com.hnas.trade.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.hnas.trade.dao.OrderDetailDao;
import com.hnas.trade.dto.DTOOrderDetail;
import com.hnas.trade.orm.OrderDetail;

@Component("orderDetailService")
//@Transactional(isolation=Isolation.READ_COMMITTED,readOnly=false,propagation=Propagation.REQUIRED,value="transactionManagerHnt")
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class OrderDetailServiceImpl implements OrderDetailService{

	@Autowired
	private OrderDetailDao orderDetailDao;
	
	@Override
	public OrderDetail saveOrUpdate(DTOOrderDetail dto) throws Exception {
		return this.orderDetailDao.saveOrUpdate(dto);
	}

	@Override
	public List<OrderDetail> findByOrderNo(String orderNo) {
		return orderDetailDao.findByOrderNo(orderNo);
	}

	@Override
	public OrderDetail findByOrderNoAndItemId(String orderNo, String itemId) {
		return orderDetailDao.findByOrderNoAndItemId(orderNo,itemId);
	}

}
